<template>
  <div class="box">
    <div class="db">
      <div>
        <span @click="fh" style="cursor: pointer">← 返回</span>
        <span style="margin-left: 8px; margin-right: 8px">|</span>
        <span>编辑企业</span>
      </div>
      <span>黑马管理员</span>
    </div>
    <div class="nr">
      <div style="padding-top: 15px; padding-left: 10px">企业信息</div>
      <div class="nr1">
        <a-form
          :label-col="{ span: 5 }"
          :wrapper-col="{ span: 24 }"
          autocomplete="off"
          @finish="onFinish"
          @finishFailed="onFinishFailed"
          :model="list2"
        >
          <a-row>
            <a-col :span="12">
              <a-form-item label="企业名称">
                <a-input
                  style="width: 482px; height: 31px"
                  placeholder="请输入企业名称"
                  v-model:value="list2.name"
                /> </a-form-item
            ></a-col>
            <a-col :span="12">
              <a-form-item label="法人">
                <a-input
                  style="width: 482px; height: 31px"
                  placeholder="请输入法人"
                  v-model:value="list2.legalPerson"
                /> </a-form-item
            ></a-col>
          </a-row>

          <a-row>
            <a-col :span="12"
              ><a-form-item label="注册地址">
                <a-input
                  style="width: 482px; height: 31px"
                  placeholder="请输入注册地址"
                  v-model:value="list2.registeredAddress"
                /> </a-form-item
            ></a-col>
            <a-col :span="12">
              <a-form-item label="所在行业">
                <a-select
                  style="width: 482px"
                  placeholder="请选择所在行业"
                  v-model:value="list2.industryName"
                >
                  <a-select-option
                    v-for="item in list1"
                    :key="item.industryCode"
                    :value="item.industryCode"
                    >{{ item.industryName }}</a-select-option
                  >
                </a-select>
                </a-form-item
              ></a-col
            >
          </a-row>
          <a-row>
            <a-col :span="12">
              <a-form-item label="营业执照">
                <a-button style="color: #4770ff; background-color: #edf5ff; border-radius: 5px"
                  >上传文件</a-button
                >
                <div style="margin-top: 10px; color: #00000073">
                  支持扩展名：.png .jpg .jpeg，文件大小不得超过5M
                </div>
              </a-form-item>
            </a-col>
          </a-row>
        </a-form>
      </div>
    </div>
    <div class="wb">
      <div style="padding-top: 15px; padding-left: 10px">联系人信息</div>
      <div class="wbxx">
        <a-form
          :model="formState"
          name="basic"
          :label-col="{ span: 5 }"
          :wrapper-col="{ span: 24 }"
          autocomplete="off"
          @finish="onFinish"
          @finishFailed="onFinishFailed"
        >
          <a-row>
            <a-col :span="12">
              <a-form-item label="企业联系人">
                <a-input
                  style="width: 482px; height: 31px"
                  placeholder="请输入企业联系人"
                  v-model:value="list2.contact"
                /> </a-form-item
            ></a-col>
            <a-col :span="12">
              <a-form-item label="联系人">
                <a-input
                  style="width: 482px; height: 31px"
                  placeholder="请输入联系电话"
                  v-model:value="list2.contactNumber"
                /> </a-form-item
            ></a-col>
          </a-row>
        </a-form>
      </div>
    </div>
    <div class="ddd">
      <div class="aaa">
        <a-button style="border-radius: 5px">重置</a-button>
        <a-button type="primary" class="vvv">确定</a-button>
      </div>
    </div>
  </div>
</template>
<script setup>
import router from '../../../router'
import { getId } from '@/utils/auth'
import { ref, onMounted } from 'vue'
import { getRole } from '@/api/enterprise'
// 点击返回企业管理
const fh = () => {
  router.back()
}
const list2 = ref({
    name:'',
    id:null,
    legalPerson:'',
    registeredAddress:'',
    industryCode:0,
    businessLicenseUrl:'',
    businessLicenseId:0,
    contact:'',
    contactNumber:'',
    industryName:''
})
const list = getId()
console.log(list);
const getIdAPI = () => {
    list2.value.name = list.name
    list2.value.legalPerson = list.legalPerson
    list2.value.registeredAddress = list.registeredAddress
    list2.value.industryName = list.industryName
    list2.value.contact = list.contact
    list2.value.contactNumber = list.contactNumber
}
const list1 = ref([])
// 获取企业列表
const getRoleAPI = async () => {
  const { data } = await getRole()
  console.log(data)
  list1.value = data
  console.log(list1.value)
}
onMounted(() => {
  getRoleAPI()
  getIdAPI()
})
</script>
<style scoped lang="scss">
.box {
  position: relative;
  width: 100%;
  height: 809px;
  background-color: #f4f6f8;
  .db {
    display: flex;
    justify-content: space-between;
    width: 100%;
    height: 64px;
    background-color: #fff;
    font-size: 16px;
    line-height: 64px;
    padding-left: 20px;
    padding-right: 20px;
  }
  .wb {
    width: 1447px;
    height: 140px;
    background-color: #fff;
    margin: auto;
    margin-top: 20px;
    .wbxx {
      width: 1317px;
      height: 56px;
      background-color: #fff;
      margin: auto;
      margin-top: 20px;
    }
  }
  .nr {
    width: 1447px;
    height: 284px;
    background-color: #fff;
    margin: auto;
    margin-top: 20px;
    .nr1 {
      width: 1340px;
      height: 200px;
      background-color: #fff;
      margin: auto;
      margin-top: 20px;
    }
  }
  .ddd {
    width: 100%;
    height: 100px;
    background-color: #fff;
    position: absolute;
    bottom: 0;
    line-height: 100px;
    .aaa {
      position: absolute;
      left: 45%;
      .vvv {
        margin-left: 25px;
        border-radius: 5px;
      }
    }
  }
}
</style>
